package com.qida.clm.core;

import android.content.Context;

/**
 * Created by edgar on 2015/12/19.
 */
public class AppGlobalContext {
    private Context mApplicationContext;
    private static AppGlobalContext sInstance;

    private AppGlobalContext(Context context){
        this.mApplicationContext = context;
    }

    public static synchronized void initialize(Context context){
        if(sInstance == null){
            sInstance = new AppGlobalContext(context);
        }
    }

    public static AppGlobalContext getInstance(){
        if(sInstance == null){
            throw new NullPointerException("Not initialize appcontext.");
        }
        return sInstance;
    }

    public Context getApplicationContext(){
        return mApplicationContext;
    }
}